package com.android2024.no5_monkey;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class GradenActivity extends AppCompatActivity
    implements View.OnClickListener{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.garden);

        findViewById(R.id.pic1).setOnClickListener(this);
        findViewById(R.id.pic2).setOnClickListener(this);
        findViewById(R.id.pic3).setOnClickListener(this);
        findViewById(R.id.pic4).setOnClickListener(this);
        findViewById(R.id.pic5).setOnClickListener(this);
        findViewById(R.id.pic6).setOnClickListener(this);
        findViewById(R.id.back).setOnClickListener(this);
    }

    private int numbel = 0;
    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.pic1:
            case R.id.pic2:
            case R.id.pic3:
            case R.id.pic4:
            case R.id.pic5:
            case R.id.pic6:
                view.setVisibility(View.GONE);
                numbel++;
                break;
            case R.id.back:
                back();
                break;
        }
    }

    private void back(){
        Intent intent = new Intent();
        intent.setClass(this,MainActivity.class);
        intent.putExtra("numbel",numbel);
        startActivity(intent);
        finish();
    }
}